<%@ page language="java" import="java.util.*" import="entity.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%user u=((user)session.getAttribute("user")); 
String name=null;
if (u!=null){
	name=u.getUser_name();
}
boolean is_mobile=(boolean)request.getAttribute("is_mobile");
List<army>armys=((List<army>)request.getAttribute("armys"));
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'home.jsp' starting page</title>
    <meta charset="utf-8"> 
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" type="text/css" href="style2.css">
	<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
	<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
  </head>
<body>



<nav class="navbar navbar-expand-sm navbar-dark" style="background-color: #333333;">
  <a class="navbar-brand" href="./home">
    云顶之奕WiKi
  </a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" href="./hero_guide">英雄图鉴</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="./equip_guide">装备图鉴</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="./hex_guide">海克斯图鉴</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="./trammel_guide">羁绊图鉴</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="./all_army">阵容查看</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="./my_army">我的阵容</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="./edit_army">阵容编辑</a>
      </li>
    </ul>
  </div>
  <%if (name==null){%>
  <div class="col-md-3 text-end">
    <button type="button" onclick="window.location.href='./account_manage/login.jsp'" class="btn btn-outline-light me-2">登录</button>
    <button type="button" onclick="window.location.href='./account_manage/sign.jsp'" class="btn btn-warning">注册</button>
  </div>
  <%}
  else{ %>
  <div class="col-md-3 text-end">
  <a class="nav-link text-light"><%=name %></a>
  <button type="button" onclick="window.location.href='./quit'" class="btn btn-outline-light me-2">退出登录</button>
  </div>
  <%} %>
  
  <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
</nav>

<div class="container-fluid bg-dark navbar-dark" style="margin:0">

<%/* 循环 */ 
for (int i=0;i<armys.size();i++){
army now = armys.get(i);%>
<div class="row">
	<div class="col-sm-2">
		<div class="d-flex justify-content-center align-items-center h-100">
			<p class="text-white-50 bg-dark">
				阵容名：<%=armys.get(i).getArmy_name()%>
			</p>
			<p class="text-white-50 bg-dark">
				作者名：<%=armys.get(i).getUser_name()%>
			</p>
		</div>
	
	</div>
		<div class="col-sm-8">
		<div class="list-group ">
			<div class="list-group-item bg-dark">
				<div class="row">
					<div class="col-sm-8">
						<div class="list-group-item bg-dark">
							<div class="row">
								<% for (int j=0;j<now.getHeroList().size();j++){
									if (is_mobile){%>
								<div class="col-4 col-sm-4">
									<a href="./search_msg?name=<%=now.getHeroList().get(j).getHero_name()%>&type=英雄 ">
										<img src="<%=now.getHeroList().get(j).getImg_url() %>" alt="阵容格子" title="<%=now.getHeroList().get(j).getHero_name()%>" style="width: 100%;">
									</a>
								</div>
								<%}
									else{%>
								<div class="col-2 col-sm-2">
									<a href="./search_msg?name=<%=now.getHeroList().get(j).getHero_name()%>&type=英雄 ">
										<img src="<%=now.getHeroList().get(j).getImg_url() %>" alt="阵容格子" title="<%=now.getHeroList().get(j).getHero_name()%>" style="width: 100%;">
									</a>
								</div>
								<%}
								} %>
							</div>
						</div>
					</div>
					
					<div class="col-sm-4">
					<div class="d-flex justify-content-center align-items-center h-100">
						<div class="list-group-item bg-dark">
							<div class="row">
								<%for (int j=0;j<now.getHexList().size();j++){ %>
								<div class="col-4 col-sm-4">
									<a href="./search_msg?name=<%=now.getHexList().get(j).getHex_name()%>&type=海克斯 ">
										<img src="<%=now.getHexList().get(j).getImg_url() %>" alt="海克斯格子" title="<%=now.getHexList().get(j).getHex_name()%>" style="width: 100%;">
									</a>
								</div>
								<%} %>
							</div>
							</div>
						</div>

					</div>
					<div class="col-sm-8">
						<div class="list-group-item bg-dark">
							<div class="row">
								<%Iterator<Map.Entry<trammel, Integer>> iterator = armys.get(i).getActive_trammelList().entrySet().iterator();
								while (iterator.hasNext()) {
									Map.Entry<trammel, Integer> entry = iterator.next();
									trammel tram = entry.getKey();
									Integer count = entry.getValue();
									if (tram.getTrammel_name().equals("召唤物")){
										continue;
									}
									if (is_mobile){%>
									<div class="col-4 col-sm-4">
										<a href="./search_msg?name=<%=tram.getTrammel_name()%>&type=羁绊 ">
											<img src="<%=tram.getImg_url() %>" alt="羁绊格子" title="<%=tram.getTrammel_name()%>" style="width: 100%;">
										</a>
									</div>
									<%}else{%>
										<div class="col-2 col-sm-2">
										<a href="./search_msg?name=<%=tram.getTrammel_name()%>&type=羁绊 ">
											<img src="<%=tram.getImg_url() %>" alt="羁绊格子" title="<%=tram.getTrammel_name()%>" style="width: 100%;">
										</a>
									</div>
									<% 	}
									} %>
							</div>
						</div>
					</div>
					
					<div class="col-sm-4">
							<div class="list-group-item bg-dark px-0">
								<div class="row">
									<%for (int j=0;j<now.getEquipList().size();j++){ %>
									<div class="col-4 col-sm-4">
										<a href="./search_msg?name=<%=now.getEquipList().get(j).getEquip_name()%>&type=装备">
											<img src="<%=now.getEquipList().get(j).getImg_url() %>" alt="装备格子" title="<%=now.getEquipList().get(j).getEquip_name()%>" style="width: 100%;">
										</a>
									</div>
									<%} %>
								</div>
							</div>
					</div>
				</div>
			</div>
		</div>
		</div>
		<%if(u!=null&&u.getType()==3){%>
		<div class="col-sm-2">
			<div class="d-flex justify-content-center align-items-center h-100">
				<form action="./score_army_msg">
        			<input type="text" class="form-control" name="score" placeholder="输入评价分数">
					<input type="hidden" name="id" value="<%=now.getArmy_id()%>"> 
        			<div class="d-flex justify-content-center align-items-center h-0">
					<button type="submit" class="btn btn-primary">提交</button>
					</div>
				</form>
				</div>		
		</div>
		<%}
		else{%>
		<div class="col-sm-2">
		<div class="d-flex justify-content-center align-items-center h-100">
			<h3 class="text-white-50 bg-dark">
				<%=now.getArmy_score()%>
			</h3>
		</div>
		</div>
		<%}%>
</div>
<%}
/* 循环结束 */ %>




<div class="row">
		<div class="col-sm-3"></div>
		<div class="col-sm-6 text-white" style="text-align:center">
  		愿您使用愉快，若发现错误或bug，请添加联系QQ：2208689304
  		</div>
		<div class="col-sm-3"></div>
	</div>
</div>
</div>
</div>
 <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
</nav>
<div id="toptop" class="toptop">   <button type="button" onclick="scrollToTop()" class="btn btn-warning" style="position:fixed;
	right:20px;
	bottom:20px;">回到顶部</div>
	</body>
<script>
function scrollToTop() {
  window.scrollTo({
    top: 0,
    left: 0,
    behavior: 'smooth'
  });
}
</script>